<template>
    <p>count: {{ count }}</p>
    <p>countWatch: {{ countWatch }}</p>
</template>

<script>
import { computed, ref } from 'vue'
export default {
  name: 'computed',
  setup () {
    const count = ref(0)
    const countWatch = computed(
      () => count.value + 1
    )
    setTimeout(() => {
      countWatch.value = 20 // 报错：computed value is readonly
    })
    return {
      count,
      countWatch
    }
  }
}
// 结果：
// count: 0  countWatch: 1
</script>
